<?php

/**
 * 用户登录 小挂件
 */
class VoiceWidget extends CoreWidget{
    public $code = 'index_voice_section';
    public $type;
    public $num;
    public $is_show;
    public $role;
    public function init(){
        if($this->getRole(Yii::app()->user->getState('user_role'),Yii::app()->user->getState('role_salt'),'manage_index_voice')){
            $this->role = true;
        }else{
            $this->role = false;
        }
        //获取section表信息
        $section_info = Section::model()->getFindSection($this->code);
        $this->type = $section_info->type;
        $this->num = $section_info->num;
        $this->is_show = $section_info->is_show;
    }
    public function run(){
        if($this->is_show==1){
            if($this->type==2){
                $info = Event::model()->getVoice($this->num);
                $this->render('voice_block',array('info'=>$info,'role'=>$this->role,'num'=>$this->num));
            }
        }
    }


}